// 布尔
let isShow: boolean = true;

// 数值
let num: number = 123;

num = NaN;
// 字符串
let str1: string = "哈哈哈";
let str2: string = "呵呵呵";
let str3: string = `呵呵呵`;

// 数组
const arr: number[] = [1, 2, 3, 4];
const arr1: string[] = ["1", "2"];
const arr2: (string | number)[] = [1, "2"];
// 泛型
const arr3: Array<number> = [1, 2, 3, 4];
// 元组 tuple
const tuple1: [number, string] = [1, "1"];
// 枚举
enum Color {
  Yellow,
  Green,
  Red,
}

console.log(Color.Yellow);
console.log(Color.Green);
console.log(Color.Red);
console.log(Color[0]);
console.log(Color[1]);
console.log(Color[2]);

// any
let a: any = 1;

a = "123123";

a = true;

a = [1, 2, 3];

// void:  当一个函数没有返回值时，你通常会见到其返回值类型是 void：
const add = () => {
  return 1;
};

// Null 和 Undefined
let num123: number = null;

num123 = 123123123;

let string123: string = undefined

string123 = '12312312'



const el = document.querySelector('.main');

// 类型断言
(<Element>el).addEventListener('click', () => {

});

(el as Element).addEventListener('click', () => {

})

el?.addEventListener('click', () => {
})

el!.addEventListener('click', () => {

})